﻿
-- 审批记录
CREATE proc [dbo].[proc_Employee_Entry_GetAuditRecord]
(
	@id int,
	@GID uniqueidentifier
)
as
	select 
		EE.Id,
		(select Enumber from Employee E where EE.EId=E.Id) as Enumber,
		(select ETempNumber from Employee E where EE.EId=E.Id) as ETempNumber,
		EE.EId,
		(select EName from Employee E where EE.EId=E.Id) as EName,
		(select IDCard from Employee E where EE.EId=E.Id) as IDCard,
		(select CompanyName from Company where id=(select companyid from employee E where EE.EId=E.Id)) as CompanyName,
		(select DName from Department where id= tdepartmentid) as DName,
		(select PostName from Post P where id= tPostId) as PostName,
		(select Post_Category.Title from Post_Category where TPostCategory= Post_Category.Id) as PostCategoryName,
		(select Title from Grade G where id= tGradeId) as GradeName,
		(select ZhiWu from Employee E where EE.EId=E.Id) as ZhiWu,
		EE.Audit,
		EE. AuditPerson,
		(select EName from Employee E where EE.AuditPerson=E.UserName) as AuditPersonName,
		EE.AuditTime,
		EE.Memo,
		IsCore,
		ISNULL(EE.TXZJB,'') AS XZJB
	from employee_entry EE
	where id = @id and GID=@GID
